package com.example.demo.model.entity;

import com.example.demo.model.dto.art.ArticlePubDto;
import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:龙宝
 * Date:2024-05-14
 * Time:9:24
 */
@Data
public class Artinfo {
    private Integer id;
    private Integer userId;
    private String title;
    private String content;
    private Long ctime;
    private Integer stat;

    public Artinfo(ArticlePubDto dto, Integer userId) {
        this.userId = userId;
        this.title = dto.getTitle();
        this.content = dto.getContent();
        if(dto.getPubTime() == 0){
            dto.setPubTime(System.currentTimeMillis());
        }
        this.ctime = dto.getPubTime();
        this.stat = dto.getStat();
    }

    //    public Artinfo(){
//        Artinfo artinfo = new Artinfo();
//        artinfo.setUserId(userId);
//        artinfo.setTitle(dto.getTitle());
//        artinfo.setContent(dto.getContent());

//        artinfo.setCtime(dto.getPubTime());
//    }
    public Artinfo(){}
}
